<?php


namespace app\common\exception;

use app\Request;
use Throwable;

class BaseException extends \Exception
{
    /**
     * 获取开发人员看的信息
     * @param string $errMsg
     * @param Request $request
     * @param Throwable $e
     * @return string
     */
    protected static function getDevMsg(string $errMsg,Request $request, Throwable $e): string
    {
        $devMsg = 'err_msg：' . $errMsg . PHP_EOL;
        $devMsg .= 'file：' . $e->getFile() . PHP_EOL;
        $devMsg .= 'line: ' . $e->getLine() . PHP_EOL;
        $devMsg .= 'param：' . json_encode($request->param(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

        return $devMsg;
    }
}